  {{- $page := .page }}
  {{- $outputFormat := .outputFormat }}
  {{- if not $page }}
    {{- $page = . }}
    {{- $outputFormat = partial "output-format.hugo" $page }}
  {{- end }}
  {{- with $page }}
    {{- $assetBusting := not .Site.Params.disableAssetsBusting }}
    {{ "<!-- https://github.com/filamentgroup/loadCSS/blob/master/README.md#how-to-use -->" | safeHTML }}
    <link href="{{"css/fontawesome-all.min.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="{{"css/fontawesome-all.min.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet"></noscript>
    <link href="{{"css/nucleus.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
    <link href="{{"css/auto-complete.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="{{"css/auto-complete.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet"></noscript>
    <link href="{{"css/perfect-scrollbar.min.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
    <link href="{{"css/fonts.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="{{"css/fonts.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet"></noscript>
    <link href="{{"css/theme.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
    {{- $autotemplate := resources.Get "css/theme-auto.css" }}
    {{- $autocss := $autotemplate | resources.ExecuteAsTemplate "css/theme-auto.css" .Site.Home }}
    {{- $c := "" }}<!-- cause Hugo to generate our theme-auto.css -->
    {{- $c = "" }}<!-- link href="{{ $autocss.RelPermalink }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet"-->
    {{- $themevariants := slice | append (.Site.Params.themeVariant | default "auto" ) }}
    {{- with index $themevariants 0 }}
    <link href="{{(printf "css/theme-%s.css" .) | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet" id="R-variant-style">
    {{- end }}
    <link href="{{"css/variant.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
    <link href="{{"css/print.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet" media="print">
    {{- $f := printf "/static/css/format-%s.css" $outputFormat }}
    {{- if partialCached "fileExists.hugo" $f $f }}
    <link href="{{(printf "css/format-%s.css" $outputFormat) | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
    {{- end }}
    <link href="{{"css/ie.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
    <script src="{{"js/url.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
    <script src="{{"js/variant.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
    <script>
      {{ "// hack to let hugo tell us how to get to the root when using relativeURLs, it needs to be called *url= for it to do its magic:" | safeJS }}
      {{ "// https://github.com/gohugoio/hugo/blob/145b3fcce35fbac25c7033c91c1b7ae6d1179da8/transform/urlreplacers/absurlreplacer.go#L72" | safeJS }}
    {{- with .Site.Home.OutputFormats.Get "JSON" }}
      {{- warnf "%q: DEPRECATED usage of 'JSON' output format found, use 'SEARCH' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/configuration/#activate-search" $page.File.Filename }}
      window.index_json_url={{ "index.json" | relLangURL }};
    {{- end }}
    {{- with .Site.Home.OutputFormats.Get "SEARCH" }}
      window.index_js_url={{ "index.search.js" | relLangURL }};
    {{- end }}
      var root_url="/";
      var baseUri=root_url.replace(/\/$/, '');
      {{ "// translations" | safeJS }}
      window.T_Copy_to_clipboard = '{{ T "Copy-to-clipboard" | safeJS }}';
      window.T_Copied_to_clipboard = '{{ T "Copied-to-clipboard" | safeJS }}';
      window.T_Copy_link_to_clipboard = '{{ T "Copy-link-to-clipboard" | safeJS }}';
      window.T_Link_copied_to_clipboard = '{{ T "Link-copied-to-clipboard" | safeJS }}';
      window.T_Reset_view = '{{ T "Reset-view" | safeJS }}';
      window.T_View_reset = '{{ T "View-reset" | safeJS }}';
      window.T_No_results_found = '{{ T "No-results-found" | safeJS }}';
      window.T_N_results_found = '{{ T "N-results-found" | safeJS }}';
      {{ "// some further base stuff" | safeJS }}
      var baseUriFull='{{ trim .Site.BaseURL "/" | safeJS }}/';
      {{- $quotedthemevariants := slice }}
      {{- range $themevariants }}
        {{- $quotedthemevariants = $quotedthemevariants | append (printf "'%s'" .) }}
      {{- end }}
      window.variants && variants.init( [ {{ delimit $quotedthemevariants ", " | safeJS }} ] );
    </script>
  {{- end }}